package com.yidu.ladder.base.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yidu.ladder.base.domain.Standard;
import com.yidu.ladder.base.domain.StandardVo;
import com.yidu.ladder.base.service.StandardService;
import com.yidu.ladder.util.ID;



@Controller
@RequestMapping("/base/")
public class StandardController {
	@Autowired
	private StandardService standardService;

	

	/**
	 * 检索
	 * 
	 * @param userVo 包装类
	 * @return 信息数据
	 */
	@ResponseBody
	@RequestMapping(value = "standards")
	public Map<String, Object> queryUser(StandardVo standardVo) {
		Map<String, Object> userMap = standardService.pageQuerystandard(standardVo);
		return userMap;
	}
	/*
	 * *** 删除
	 * 
	 * @param Staff
	 * 
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="standard/{standardId}/{userable}",method=RequestMethod.DELETE)
	public String frozenORrecoverArchives(@PathVariable("standardId") String standardIdstr, @PathVariable("userable") String userable) {
		boolean result = standardService.updatefreeze(standardIdstr, userable);
		if(result==false) {
			return "fail";
		}
		return "success";
	}
	
	/**
	 * 添加数据
	 * 
	 * @param archives
	 * @re9turn
	 */
	@RequestMapping(value = "addstandard", method = RequestMethod.POST)
	@ResponseBody
	public int addstandard(Standard standard) {
		    standard.setStandardId(ID.getUUID());
		    System.out.println(standard);
			int dd = standardService.addstaff(standard);
			return dd;
		 } 
	/***
	 * 修改数据
	 * 
	 * @param archives
	 * @return
	 */
	@RequestMapping(value = "updatestandard", method = RequestMethod.POST)
	@ResponseBody
	public int updateStaff(Standard standard) {
			int dd = standardService.updatepicture(standard);
			return dd;
		 } 
}
